package com.example.admintor.threehome.data;


import android.content.Context;

import com.example.wzsdk.login.Landing;
import com.example.wzsdk.scan.Search;

import java.io.Serializable;

/**
 * Created by Admintor on 2018/1/17.
 */

public class ReciveDateHander implements Serializable {

    private ReciveBean reciveBean;
    private Search wzoneSearch;
    private Landing wzoneLanding;
    private boolean state = false;

    public ReciveDateHander(Context context) {
        reciveBean = new ReciveBean();
        wzoneSearch = new Search("SANJIANFANG", context);
        wzoneLanding = new Landing("SANJIANFANG");
    }

    public void ReciverDispose(String uiid, byte b, String index) {
        switch (uiid) {
            case Datas.HT_Uiid:
                if (index.equals("1")) {
                    reciveBean.setTem(b + "");
                } else if (index.equals("2")) {
                    reciveBean.setHum(b + "");
                }
                break;

            case Datas.Sm_Uiid:
                if (index.equals("1")) {
                    reciveBean.setSmoke(b + "");
                }
                break;

            case Datas.Ill_Uiid:
                if (index.equals("1")) {
                    reciveBean.setIll(b + "");
                }
                break;
            case Datas.RT_Uiid:
                if (index.equals("1")) {
                    reciveBean.setRtstr(b + "");
                }
                break;
        }
    }

    public void ReciverDisposeing(String uiid, byte b, String index) {
        switch (uiid) {
            case Datas.HT_Uiid:
                if (index.equals("1")) {
                    reciveBean.setTem(b + "");
                } else if (index.equals("2")) {
                    reciveBean.setHum(b + "");
                }
                break;

            case Datas.Sm_Uiid:
                if (index.equals("1")) {
                    reciveBean.setSmoke(b + "");
                }
                break;

            case Datas.Ill_Uiid:
                if (index.equals("1")) {
                    reciveBean.setIll(b + "");
                }
                break;
            case Datas.RT_Uiid:
                if (index.equals("1")) {
                    reciveBean.setRtstr(b + "");
                }
                break;
            case Datas.RFID_Uiid:
                if (state == false) {
                    wzoneLanding.setKeyByUiid(Datas.MJ_Uiid, Datas.MJ_OPEN);
                    state = true;
                } else {
                    wzoneLanding.setKeyByUiid(Datas.MJ_Uiid, Datas.MJ_CLOSE);
                    state = false;
                }
                break;
            case Datas.Sound_Uiid:
                if (index.equals("1")) {
                    if (b == 1) {
                        wzoneLanding.setKeyByUiid(Datas.DD_Uiid, Datas.DD_OPEN);
                    } else if (b == 0) {
                        wzoneLanding.setKeyByUiid(Datas.DD_Uiid, Datas.DD_CLOSE);
                    } else if (b == 6) {
                        wzoneLanding.setVariableByUiid(Datas.BB_Uiid, "1", Integer.parseInt(reciveBean.getTem()));
                    }
                }
                break;
        }
    }

    public ReciveBean getReciveBean() {
        return reciveBean;
    }

    public void setReciveBean(ReciveBean reciveBean) {
        this.reciveBean = reciveBean;
    }

    public Search getWzoneSearch() {
        return wzoneSearch;
    }

    public void setWzoneSearch(Search wzoneSearch) {
        this.wzoneSearch = wzoneSearch;
    }

    public Landing getWzoneLanding() {
        return wzoneLanding;
    }

    public void setWzoneLanding(Landing wzoneLanding) {
        this.wzoneLanding = wzoneLanding;
    }
}
